package com.umeox.recorder.data;

import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.PrimaryKey;

import static com.umeox.recorder.data.RecorderBean.TABLE_NAME;

@Entity(tableName = TABLE_NAME)
public class RecorderBean {

    @Ignore
    public static final String TABLE_NAME = "recorder";

    @PrimaryKey(autoGenerate = true)
    public long id;

    private long createTime;

    private long duration;

    private String filePath;

    private String name;

    @Ignore
    private boolean playing;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public long getDuration() {
        return duration;
    }

    public void setDuration(long duration) {
        this.duration = duration;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof RecorderBean)) return false;

        RecorderBean that = (RecorderBean) o;

        return id == that.id;
    }

    @Override
    public String toString() {
        return "RecorderBean{" +
                "id=" + id +
                ", createTime=" + createTime +
                ", duration=" + duration +
                ", filePath='" + filePath + '\'' +
                ", name='" + name + '\'' +
                ", playing=" + playing +
                '}';
    }

    @Override
    public int hashCode() {
        return (int) (id ^ (id >>> 32));
    }

    public boolean isPlaying() {
        return playing;
    }

    public void setPlaying(boolean playing) {
        this.playing = playing;
    }
}
